<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>悬浮效果</title>
</head>
<style>
    * {
        margin: 0;
        padding: 0;
        list-style: none;
        text-align: none;
    }
    
    body {
        background-color: black;
    }
    
    ul {
        margin: 0 auto;
        width: 1000px;
        height: 300px;
        position: relative;
    }
    
    li img {
        float: left;
        width: 250px;
        height: auto;
        padding: 30px 20px;
    }
    
    .box1 {
        line-height: 190px;
        text-align: center;
        width: 250px;
        height: 190px;
        padding: 30px 20px;
        position: absolute;
        top: 0;
        left: 0;
        background-color: rgba(0, 0, 0, 0.5);
        color: white;
        font-size: 16px;
        display: none;
        opacity: 0;
    }
    
    .box2 {
        line-height: 190px;
        text-align: center;
        width: 250px;
        height: 190px;
        padding: 30px 20px;
        position: absolute;
        top: 0;
        left: 290px;
        background-color: rgba(0, 0, 0, 0.5);
        color: white;
        font-size: 16px;
        display: none;
        opacity: 0;
    }
    
    .box3 {
        line-height: 190px;
        text-align: center;
        width: 250px;
        height: 190px;
        padding: 30px 20px;
        position: absolute;
        top: 0;
        left: 580px;
        background-color: rgba(0, 0, 0, 0.5);
        color: white;
        font-size: 16px;
        display: none;
        opacity: 0;
    }
    
    .btn1:hover .box1 {
        display: block;
        animation-name: suspend;
        animation-duration: 1200ms;
        animation-timing-function: linear;
        opacity: 1;
    }
    
    .btn2:hover .box2 {
        display: block;
        animation-name: suspend;
        animation-duration: 1200ms;
        animation-timing-function: linear;
        opacity: 1;
    }
    
    .btn3:hover .box3 {
        display: block;
        animation-name: suspend;
        animation-duration: 1200ms;
        animation-timing-function: linear;
        opacity: 1;
    }
    
    @keyframes suspend {
        0% {
            transform: perspective(400px) rotate3d(0, 1, 0, 90deg);
            animation-timing-function: ease-in;
            /*缓动函数*/
            opacity: 0;
        }
        40% {
            transform: perspective(400px) rotate3d(0, 1, 0, -20deg);
            animation-timing-function: ease-in;
            /*缓动函数*/
        }
        60% {
            transform: perspective(400px) rotate3d(0, 1, 0, 10deg);
            animation-timing-function: ease-in;
            /*缓动函数*/
            opacity: 1;
        }
        80% {
            transform: perspective(400px) rotate3d(0, 1, 0, -5deg);
            animation-timing-function: ease-in;
            /*缓动函数*/
        }
        100% {
            transform: perspective(400px);
            animation-timing-function: ease-in;
            /*缓动函数*/
        }
    }
</style>

<body>
    <ul>
        <li class="btn1"><img src="imgs/1.jpg">
            <div class="box1">看不见我，看不见我</div>
        </li>
        <li class="btn2"><img src="imgs/2.jpg">
            <div class="box2">看不见我，看不见我</div>
        </li>
        <li class="btn3"><img src="imgs/3.jpg">
            <div class="box3">看不见我，看不见我</div>
        </li>

    </ul>
</body>

</html>